//姓名脱敏展示
function getName(name) {
    let newStr
    if (name.length === 2) {
        newStr = name.substr(0, 1) + '*'
    } else if (name.length > 2) {
        let char = ''
        for (let i = 0, len = name.length - 2; i < len; i++) {
            char += '*'
        }
        newStr = name.substr(0, 1) + char + name.substr(-1, 1)
    } else {
        newStr = name
    }
    return newStr
}
//手机号码脱敏展示
function getPhone(tel) {
    if (!tel) return tel;
    const phone = tel.replace(tel.substring(3, 7), '****')
    return phone
}

export { getName, getPhone }